package com.wujilee.wujileenetty.demos.web.nio;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;

/**
 * @author liwuji
 * @date 2024/8/5
 * @desc
 **/
public class WriteClient {
    public static void main(String[] args) throws IOException {
        SocketChannel open = SocketChannel.open();
       open.connect(new InetSocketAddress("127.0.0.1",6666));
        int count = 0;
        while (true){
            ByteBuffer allocate = ByteBuffer.allocate(1024 * 1024);
            count = count+ open.read(allocate);
            System.out.println(count);
        }
    }
}
